class Solution:
    def __init__(self):
        self.res = []
        self.temp = []

    def func(self, now: int):
        if len(self.temp) == self.k:
            te = self.temp.copy()
            self.res.append(te)
        for i in range(now+1, self.n + 1):
            self.temp.append(i)
            self.func(i)
            self.temp.remove(i)

    def combine(self, n: int, k: int):
        self.n = n
        self.k = k
        self.func(0)
        return self.res


# if __name__ == "__main__":
#     s = Solution()
#     res = s.combine(4, 2)
#     print(res)
